/*
 * @Description: In User Settings Edit
 * @Author: your name
 * @Date: 2019-09-10 14:21:48
 * @LastEditTime: 2019-10-21 16:41:33
 * @LastEditors: Please set LastEditors
 */
import axios from 'axios';
import { Toast } from "mint-ui";
import store from '../store/index'


// //自定义配置创建axios的新实例
const service = axios.create({
  // baseURL:'api/hwb_client/V1.0.0',
   baseURL:'https://www.meilibaobiao.com:8443/hwb_client/V1.0.0',
  timeout: 50000,
  withCredentials: true
})

// 请求拦截器,发起请求,打开loading
service.interceptors.request.use(
  config => {
    // if (store.state.token) {
    //   config.headers.Authorization = store.state.token
    //   config.headers['Content-Type'] = 'application/json;charset=UTF-8'
    // }
    return config;
  }, err => {
    return Promise.reject(err)
  })
//响应拦截器,响应回来关闭loading
service.interceptors.response.use(
  response => {
    return response;
  }, err => {
    Toast('网络延迟....')
    return Promise.reject(err);
    
  }
)

export default service;
